package com.ss.isc.data.system.service;

import com.ss.isc.data.system.client.IUserManageService;
import com.ss.isc.data.system.common.model.Role;
import com.ss.isc.data.system.common.model.User;
import com.ss.isc.data.system.mapper.RoleManageMapper;
import com.ss.isc.data.system.mapper.UserManageMapper;
import com.github.pagehelper.PageHelper;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;














@Service
public class UserManageServiceImpl
  implements IUserManageService
{
  @Autowired
  private UserManageMapper userManageMapper;
  @Autowired
  private RoleManageMapper roleMapper;
  
  public List<User> pages(User dto) {
    PageHelper.startPage(dto.getPageNum().intValue(), dto.getPageSize().intValue());
    List<User> uList = this.userManageMapper.pages(dto);
    for (User user : uList) {
      Role roleDTO = new Role();
      roleDTO.setUserId(user.getUserId());
      List<Role> rList = this.roleMapper.list(roleDTO);
      user.setrList(rList);
    } 
    
    return uList;
  }
}
